Component({
  properties: {
    spotId: { type: String, value: "" },
    editable: { type: Boolean, value: true },
    baseInfo: { type: Object, value: {} },
    fishStockData: { type: Array, value: [] },
    fishReturnData: { type: Array, value: [] },
    tagFishData: { type: Array, value: [] },
    feeData: { type: Array, value: [] },
    deposit: { type: String, value: "" },
    date: { type: String, value: "" },
  },

  methods: {
    // 通用的保存事件冒泡处理
    onFieldSave(e) {
      let { field } = e.currentTarget.dataset;
      const detail = e.detail;

      console.log("---f-session---onFieldSave---", e);

      if (e.detail.field) {
        field = detail.field;
      }
      this.triggerEvent("save", {
        field, // 将子组件的字段名传递上去
        detail, // 将原始的事件详情也传递上去
      });
    },

    // 处理输入变化
    onInputChange(e) {
      const { feild } = e.currentTarget.dataset;
      console.log("---feild---xxxx---", feild, e.detail.value);

      this.setData({
        [feild]: e.detail.value,
      });
    },

    // 通用的删除事件冒泡处理
    onFieldDelete(e) {
      const { field } = e.currentTarget.dataset;
      this.triggerEvent("delete", {
        field: field, // 将子组件的字段名传递上去
        detail: e.detail, // 将原始的事件详情也传递上去
      });
    },
  },
});
